package com.example.consumer.controller;

import com.example.consumer.config.i18n.MessageSourceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: I18nController
 * @Author: Havey
 * @Description: 测试i18n
 * @Date: 2019/5/29 9:46 AM
 * @Version: 1.0
 */
@RestController
public class I18nController {

    @Autowired
    private MessageSourceUtil messageSourceUtil;

    @RequestMapping(value = "testI18n",method = RequestMethod.GET)
    public String testI18n(){
        String str = messageSourceUtil.getMessage("user.title");
        System.out.println("user.title:" + messageSourceUtil.getMessage("user.title"));
        System.out.println("user.welcome:" + messageSourceUtil.getMessage("user.welcome"));
        System.out.println("user.username:" + messageSourceUtil.getMessage("user.username"));
        System.out.println("user.password:" + messageSourceUtil.getMessage("user.password"));
        return str;
    }
}
